import Vue from "vue";
import Vuex from "vuex"
import mutations from "./mutations";
import actions from "./actions";
import getters from "./getters";
import moduleA from "./modules/moduleA";

// 1. 安装Vuex
Vue.use(Vuex)

// 2. 创建对象
const state = {
  counter: 1000,
  students: [
    { name: 'kele', age: 18 },
    { name: 'coderWhy', age: 21 },
    { name: 'james', age: 30 },
    { name: 'curry', age: 10 },
  ],
  info: {
    name: 'kobe',
    age: 40,
    height: 1.98
  }
}

const store  = new Vuex.Store({
  state: state,
  mutations: mutations,
  actions: actions,
  getters: getters,
  modules: {
    a: moduleA
  }
})

export default store

